import request from "/@/core/axios";

const prefixUrl = "/menu";

/**
 * 获取全部的菜单分页（父子结构）
 */

export const getMenuPage = () =>
  request({
    url: `${prefixUrl}/page`,
    method: "get",
  });

/**
 * 创建菜单
 * @param data
 */
export const createMenu = (data: any) =>
  request({
    url: `${prefixUrl}/create`,
    method: "post",
    data,
  });

/**
 * 删除菜单
 */
export const deleteMenu = (id: number) =>
  request({
    url: `${prefixUrl}/delete`,
    method: "get",
    params: {
      id,
    },
  });

/**
 * 获取菜单详情
 */

export const getMenuDetail = (id: number) =>
  request({
    url: `${prefixUrl}/detail`,
    method: "get",
    params: {
      id,
    },
  });

/**
 * 更新菜单
 */
export const updateMenu = (data: any) =>
  request({
    url: `${prefixUrl}/update`,
    method: "post",
    data,
  });
